// 导入组件
import Vue from 'vue';
import Router from 'vue-router';
let push = Router.prototype.push;
let replace = Router.prototype.replace;
//重写VueRouter.prototype原型对象的push|replace方法
Router.prototype.push = function (location) {
  //调用push方法且篡改push方法内部this指向->vueRouter类的实例
  push.call(this, location, () => { }, () => { });
}
Router.prototype.replace = function (location) {
  //调用push方法且篡改push方法内部this指向->vueRouter类的实例
  replace.apply(this, [location, () => { }, () => { }]);
}
// 登录
// import login from '@/views/login';
// 首页
import index2 from '@/views/index2';
import index from '@/views/index';
/**
 * 基础菜单
 */
// 商品管理
import Goods from '@/views/goods/Goods';
import Market from '@/views/wholesaleMarket/Index'
import ShopInfo from '@/views/wholesaleMarket/ShopInfo'
// 启用路由
Vue.use(Router);

// 导出路由 
export default new Router({
  routes: [{
    path: '/',
    name: '',
    component: index,
    hidden: true
  }, {
    path: '/index',
    name: '',
    component: index2,
    hidden: true
  }, {
    path: '/main',
    name: '首页',
    component: index,
    iconCls: 'el-icon-tickets',
    children: [
      {
        path: '/goods/Goods',
        name: '商品管理',
        component: Goods
      }, {
        path: '/goods/index',
        name: '商铺信息',
        component: () => import('@/views/goods/index')
      },
      ,
      {
        path: '/basicInformation/application',
        name: '商铺摊位申请',
        component: () => import('@/views/wholesaleMarket/application')
      },
      {
        path: '/basicInformation/rule',
        name: '不合规数据分析',
        component: () => import('@/views/wholesaleMarket/rule')
      },
      {
        path: '/basicInformation/commerce',
        name: '电商基本信息管理',
        component: () => import('@/views/commerce/basic')
      },
      {
        path: '/basicInformation/trade',
        name: '电商交易数据对接与维护',
        component: () => import('@/views/commerce/trade')
      },
      {
        path: '/basicInformation/commerceRule',
        name: '不合规数据分析',
        component: () => import('@/views/commerce/rule')
      },
      {
        path: '/basicInformation/price',
        name: '综合指导价格推送',
        component: () => import('@/views/commerce/price')
      },
      {
        path: '/basicInformation/public',
        name: '区域公众品牌',
        component: () => import('@/views/brand/public')
      },
      {
        path: '/basicInformation/famous',
        name: '知名企业品牌',
        component: () => import('@/views/brand/famous')
      },
      {
        path: '/basicInformation/exhibition',
        name: '展会信息管理',
        component: () => import('@/views/exhibition/index')
      },
      {
        path: '/wholesaleMarket/index',
        name: '基本人事档案',
        component: Market,
      }, {
        path: '/wholesaleMarket/shopInfo',
        name: '商铺信息',
        component: ShopInfo
      }, {
        path: '/agManage/product',
        name: '产品管理',
        component: () => import('@/views/agManage/Product')
      }, {
        path: '/agManage/fieldArchives',
        name: '田间档案',
        component: () => import('@/views/agManage/FieldArchives')
      }, {
        path: '/agManage/enterpriseInfo',
        name: '企业信息',
        component: () => import('@/views/agManage/EnterpriseInfo')
      }, {
        path: '/agManage/producerInfo',
        name: '产品信息',
        component: () => import('@/views/agManage/ProducerInfo')
      }, {
        path: '/agManage/warehouse',
        name: '仓储加工',
        component: () => import('@/views/agManage/Warehouse')
      },
      {
        path: '/agManage/logisticsInfo',
        name: '物流信息',
        component: () => import('@/views/agManage/LogisticsInfo')
      },
      {
        path: '/agManage/publicTrust',
        name: '公信检测',
        component: () => import('@/views/agManage/PublicTrust')
      },
      {
        path: '/agManage/nutritive',
        name: '营养价值',
        component: () => import('@/views/agManage/Nutritive')
      },
      {
        path: '/agManage/health',
        name: '健康食谱',
        component: () => import('@/views/agManage/Health')
      },
      {
        path: '/agManage/wholeCourseResume',
        name: '履历档案',
        component: () => import('@/views/agManage/WholeCourseResume')
      },
      {
        path: '/agManage/traceability',
        name: '生产溯源码',
        component: () => import('@/views/agManage/Traceability')
      },
      {
        path: '/agManage/resumeCode',
        name: '履历赋码',
        component: () => import('@/views/agManage/ResumeCode')
      },
      {
        path: '/agManage/resume',
        name: '全程履历',
        component: () => import('@/views/agManage/Resume')
      },
      {
        path: '/system/user',
        name: '用户管理',
        component: () => import('@/views/system/UserInfo')
      }, {
        path: '/system/role',
        name: '角色管理',
        component: () => import('@/views/system/RoleInfo')
      }, {
        path: '/system/menu',
        name: '菜单管理',
        component: () => import('@/views/system/MenuInfo')
      }, {
        path: '/system/depart',
        name: '部门管理',
        component: () => import('@/views/system/DepartInfo')
      }, {
        path: '/system/post',
        name: '岗位管理',
        component: () => import('@/views/system/PostInfo')
      }
    ]
  }]
})